# coding=utf-8
# 代码文件：chapter12/ch12.2.2.py
import tkinter as tk

window = tk.Tk()

window.geometry('280x180')

window.title('grid布局')

# 声明颜色列表colours
colours = ['red', 'green', 'orange', 'white', 'yellow', 'blue']

r = 0
for c in colours:
    # 创建标签控件
    tk.Label(text=c, width=15).grid(row=r, column=0)
    # 创建文本框件
    tk.Entry(bg=c, width=10).grid(row=r, column=1)
    r = r + 1
window.mainloop()
